package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Phone    string `gorm:"type:char(11);not null;comment:'用户手机号'" json:"phone"`
	Password string `gorm:"type:char(32);not null;comment:'用户密码'" json:"password"`
}

func (u *User) Create() error {
	return DB.Debug().Create(&u).Error

}

func (u *User) Find(phone string) error {
	return DB.Debug().Where("phone =?", phone).Find(&u).Error
}
